# file i/o routines
from datetime import datetime

filename_feedings = "data/max_data_feedings"
filename_wet      = "data/max_data_wet"
filename_poopy    = "data/max_data_poopy"
filename_unknown  = "data/max_data_unknown"

# read_data - open the files and populate basic arrays of timestamps
def read_data():
	
	d_feed = []
	d_wet = []
	d_poop = []
	d_unknown = []

	with open(filename_feedings, 'r') as f:
		for line in f:
			d_feed.append(line)
	with open(filename_wet, 'r') as f:
		for line in f:
			d_wet.append(line)
	with open(filename_poopy, 'r') as f:
		for line in f:
			d_poop.append(line)
	with open(filename_unknown, 'r') as f:
		for line in f:
			d_unknown.append(line)

	return d_feed, d_wet, d_poop, d_unknown

def update_feedings():
	d = datetime.now()
	with open(filename_feedings, 'a') as f:
		f.write(str(d) + "\n")
	return str(d)

def update_wet():	
	d = datetime.now()
	with open(filename_wet, 'a') as f:
		f.write(str(d) + "\n")
	return str(d)

def update_poopy():	
	d = datetime.now()
	with open(filename_poopy, 'a') as f:
		f.write(str(d) + "\n")
	return str(d)

def update_unknown():	
	d = datetime.now()
	with open(filename_unknown, 'a') as f:
		f.write(str(d) + "\n")
	return str(d)

